def spam():
    global eggs  # 全局变量
    eggs = 'spam'

def bacon():
    eggs = 'bacon'
def ham():
    print(eggs)  # 全局变量：没有用在赋值语句中

eggs = 42  # 全局变量
spam()
print(eggs)
